Skip to content

Data parity for seasons and episodes#1593

Merged
JonnyWong16 merged 20 commits intopushingkarmaorg:masterfrom
Touchstone64:data-parity-for-seasons-and-episodes
Mar 18, 2026
Merged

Data parity for seasons and episodes#1593
JonnyWong16 merged 20 commits intopushingkarmaorg:masterfrom
Touchstone64:data-parity-for-seasons-and-episodes

Conversation

@Touchstone64
Copy link
Contributor

Description

This PR includes a mixin supporting a key builder suitable for all TV parent/child searches, including guids unless specifically instructed otherwise, and implements it for all object-retrieving methods as described in #1592.

Fixes #1592

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods
  • I have added tests when applicable

In all honesty I've had great difficulty setting up an 'all-tests-pass' test harness with tools/plex-bootstraptest.py, but I have been able to use it to create an environment that could run the new unit tests individually. The new tests all fail when the mixin's _buildRelationKey() includeGuids code is commented out, and pass when it's reinstated, so I'm happy that the changes are effective and the unit tests are of value.

Please feel free to make or suggest any changes that would help pull this PR into line with the spirit of this repo.

@Touchstone64
Copy link
Contributor Author

I'm out of depth trying to solve the failing CI step as I'm unfamiliar with Github actions, but I'll do some research and see if I can offer any solutions.

@JonnyWong16
Copy link
Collaborator

The test failure is just a caching issue.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a TV parent/child relation key builder to align GUID inclusion across show/season/episode “member” retrieval methods with library search behavior (per #1592).

Changes:

  • Introduces TvParentChildMixin._buildRelationKey() to append relation query params (including includeGuids by default).
  • Updates Show, Season, and Episode retrieval methods to use _buildRelationKey() when fetching related objects.
  • Adds/updates tests to assert GUID presence on related objects without relying on auto-reload behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
plexapi/video.py Switches show/season/episode relation fetches to use _buildRelationKey() so returned partials include GUIDs.
plexapi/mixins/tv_parent_child.py Adds the new key-building helper for TV parent/child relations.
plexapi/mixins/__init__.py Wires the new mixin into ShowMixins, SeasonMixins, and EpisodeMixins.
tests/test_video.py Adds assertions/tests to validate GUID availability for related TV objects.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@Touchstone64
Copy link
Contributor Author

Touchstone64 commented Mar 16, 2026

The change to the key-building implementation in Episode._season() in this commit shows where my confusion started (and hopefully ends). Including an XML attribute in the key-building call worked (because the final query string was syntactically correct) but it was implementing completely the wrong pattern.

Episode._season() now stands as the perfect example of the way that _buildRelationalKey() and XML attributes should be used together in a fetchItem() call.

So sorry for the confusion!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a shared key-builder to ensure TV show/season/episode relationship fetches include GUIDs (matching LibrarySection.search() behavior), and updates the relevant member methods plus tests to validate guid presence on partial objects.

Changes:

  • Introduce TvParentChildMixin._buildRelationalKey() to consistently append includeGuids=1 (and related query params) for parent/child fetch endpoints.
  • Update Show, Season, and Episode relationship/object-retrieval methods to use _buildRelationalKey(...).
  • Add/extend unit tests to assert guid parity for show/season/episode relationship methods without triggering auto-reloads.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
plexapi/mixins/tv_parent_child.py New mixin to construct parent/child fetch keys with includeGuids=1.
plexapi/mixins/__init__.py Wires TvParentChildMixin into ShowMixins, SeasonMixins, and EpisodeMixins.
plexapi/video.py Switches TV relationship methods to use _buildRelationalKey(...) for guid parity.
tests/test_video.py Adds tests verifying GUIDs are present on related partial objects without auto-reload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Collaborator

@JonnyWong16 JonnyWong16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more change and it looks good.

Thanks for adding this.

@Touchstone64
Copy link
Contributor Author

Final thought ... originally the intent was to provide a key-builder for objects that had some kind of parent-child relationship (episode <-> season <-> show), hence the name _buildRelationalKey(). Now that the method is more general-purpose, perhaps it would be better renamed, perhaps _buildQueryKey(). Up to you!

Either way, thanks for your time and support.

@JonnyWong16
Copy link
Collaborator

_buildQueryKey() is a good idea.

Copy link
Collaborator

@JonnyWong16 JonnyWong16 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks.

@JonnyWong16 JonnyWong16 merged commit ceb085d into pushingkarmaorg:master Mar 18, 2026
5 checks passed
@Touchstone64 Touchstone64 deleted the data-parity-for-seasons-and-episodes branch March 18, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure data parity for shows, seasons and episodes retrieved by search methods and member methods

3 participants